package xyz.wongs.gry.synx.clazz
/**
 * @ClassName
 * @Description
 * @author WCNGS@QQ.COM
 * @Github <a> https://github.com/rothschil</a>
 * @date 2020/12/21 10:58
 * @Version 1.0.0
 */

// 1、类定义
class Persion{
    private String name
    private int age
    def getName(){
        return this.name
    }
}
p = new Persion(name:"WONGS")
println("【类定义】"+ p.getName())

// 2、对象集合

def persons =[
        new Persion(name:"WONGS"),
        new Persion(name:"Zhang")
]

def handle(msg){
    println("【handle函数处理】"+ msg.@name)
}

// 利用each 闭包特点，将迭代的数据内容传递到 handle(msg)函数中
persons.each {this.&handle}
// 输出全部集合中指定属性内容
println(persons*.getName())